package com.lingx.model.impl;

import java.util.Map;

import com.lingx.model.IContext;
import com.lingx.model.IExecutor;
import com.lingx.model.IPerformer;
import com.lingx.model.annotation.FieldModelConfig;

public class ExpressionExecutor extends AbstractModel implements IExecutor {
	
	private static final long serialVersionUID = -4485152402747428526L;

	@FieldModelConfig(sort="5",name="脚本代码",inputType="string",editor="display")
	private String script;
	public ExpressionExecutor(){
		super();
		this.setName("JavaScript代码");
		this.setIconCls("el-icon-pear");
	}

	public Object execute(Map<String, Object> params,IContext context,IPerformer jsper) throws Exception {
		Object obj=jsper.executeScript(script,context);
		return obj;
	}

	public String getScript() {
		return script;
	}

	public void setScript(String script) {
		this.script = script;
	}
}
